package main

import "fmt"

type Person1 struct {
	name string
}

func (tmp *Person1) PrintInfo() {
	fmt.Printf("name=%s",tmp.name)
}

type Student1 struct {
	Person1
	addr string
}

// 重写：Student1也实现了PrintInfo方法
func (tmp Student1) PrintInfo() {
	fmt.Println("重写的方法")
}

func main()  {
	s :=Student1{Person1{"rowger"},"广东省深圳市"}
	//就近原则
	s.PrintInfo()
	s.Person1.PrintInfo()
}